const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors())
app.get('/user/:userId', (req, res) => {
    const userId = req.params.userId;
    return res.json({
        userId,
        name: 'mary',
        email: 'mary@qq.com'
    });
});
app.get('/search', (req, res) => {
    const keyword = req.query.keyword;
    setTimeout(() => {
        const results = Array.from({ length: 10 }, (_, i) => `${keyword}${i + 1}`)
        res.json(results);
    }, 1000);
});
app.listen(3000, () => console.log(`server is running on port 3000`));